<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="teams.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page errorPage="error.jsp" %>
<%@ include file="header.jspf" %>
<%@ include file="team_header.jspf" %>

<%
    Team team = TeamFabric.getInstance(((Integer) session.getAttribute("sport")).intValue());
%>

<section class="middle">

    <div class="wide-teaser">
        <h3>Add team</h3>
        <br class=clear/>	
        
            <p>
                    Name:
						<input type=text name="name" class="search-input"> </th>
                    &nbsp;&nbsp;City:
						<input type=text name="city" class="search-input"> </th>
                    
            </p>
        <br>
        
        <table class="search-table" cellspacing="0" cellpadding="0">
            <tbody>
                <%
                    if (team != null) {
                        List attrs = team.getAttrsNames();
                        List inputs = new ArrayList();
                        for (int i = 0; i < attrs.size(); i++) 
                            if (!attrs.get(i).equals("city") &&!attrs.get(i).equals("name") && !attrs.get(i).equals("id") && !attrs.get(i).equals("sportId")) 
                            inputs.add(attrs.get(i));
                        for (int j = 0; j < inputs.size(); j++)    
                            if (j % 3 == 0) {
                %>
                <tr>
                    <th class="criterion"><%=inputs.get(j)%>:</th>
                    <th>                        
                        &nbsp;&nbsp;<input type=text name="<%=inputs.get(j)%>" class="search-input">                        
                    </th>
                    <%
                    } else if (j % 3 == 1) {%>
                    <th class="criterion"><%=inputs.get(j)%>:</th>
                    <th>                        
                        &nbsp;&nbsp;<input type=text name="<%=inputs.get(j)%>" class="search-input" >
                    </th>
                    <%
                    } else if (j % 3 == 2) {%>
                    <th class="criterion"><%=inputs.get(j)%>:</th>
                    <th>                        
                        &nbsp;&nbsp;<input type=text name="<%=inputs.get(j)%>" class="search-input">
                    </th>
                </tr> <%
                }
                
                                                       }
                                              
                
                %>    
					
				

            </tbody>
        </table>
        
        
        <script type="text/javascript" src="script.js"></script>

        <br class=clear>
        <button class=sportbutton onclick="add('team')">add</button>
        &nbsp;&nbsp;
        <button class=sportbutton onclick="window.location='teams.jsp';">cancel</button>

    </div>
</section>

<%@ include file="footer.jspf" %>